UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mpuy9O3DEfOvlY03Uh3GJwKtdt7r6VDL0p9qfuVIuTw=' 
WHERE 
  key_id = '2a7e65526f56c07085f393e5d69d5c00a62c7773594a71d741b039715fc21408' 
  AND (
    token = 'Mpuy9O3DEfOvlY03Uh3GJwKtdt7r6VDL0p9qfuVIuTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046