UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IyEnNsMz1mxvuNSD07c9C3b+1OVkeoXJc0RRORP9Itk=' 
WHERE 
  key_id = 'c1288e9da5fa89399b1bb8f13e38a4f51c9c78686ebac13055f1f0be224f314d' 
  AND (
    token = 'IyEnNsMz1mxvuNSD07c9C3b+1OVkeoXJc0RRORP9Itk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045