UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fp03aQ0UtfF84rWIDFpxmdVGqYZMdIj2DRek+CuSbWQ=' 
WHERE 
  key_id = '11a27d9305d7bb0b87ce2d6009955ecc8f1ff2fe99d2e59b03b3af40eb3d7224' 
  AND (
    token = 'fp03aQ0UtfF84rWIDFpxmdVGqYZMdIj2DRek+CuSbWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018