UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tw+XuigfgF2CgWLFcsfffS5MWE4Hy4i0UmlQL7ZjDSM=' 
WHERE 
  key_id = '4a68f0e1705d18958e62de334006ac712d2c4382d86b002855b9ba293e2517c3' 
  AND (
    token = 'Tw+XuigfgF2CgWLFcsfffS5MWE4Hy4i0UmlQL7ZjDSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039