UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'af/T0V6AuU7/Po0MPvdAWtJkFEMxyzauT/P+1ClDFgA=' 
WHERE 
  key_id = 'bd1f6a5c7d7d1387de4cc33dbfd98000e22f9e8ea8d0ad873e6569fda19701b8' 
  AND (
    token = 'af/T0V6AuU7/Po0MPvdAWtJkFEMxyzauT/P+1ClDFgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032