UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Anpr1ACp3Q7StWY7XfCcI1ZqaY09NwI3OfLOMXYwYBs=' 
WHERE 
  key_id = 'f8af3fd10ab3d586781698a6742d34a364799d71e229753e7ceeef20213432f1' 
  AND (
    token = 'Anpr1ACp3Q7StWY7XfCcI1ZqaY09NwI3OfLOMXYwYBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031