UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXVr9U0vvi3OCP227+JeqC5hDMn1Hyup4xOuF1gF3Oo=' 
WHERE 
  key_id = '7e61f8f12b9df38bf184655a7708553ead9df5d55b9a4609125bc9e7e4b461d5' 
  AND (
    token = 'fXVr9U0vvi3OCP227+JeqC5hDMn1Hyup4xOuF1gF3Oo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030