UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxnl0dkGvtv3hdPx4dauk4hWE9OJF7+U1ESPHEqn9lw=' 
WHERE 
  key_id = '6b5f7526071791e47978daa28ec43427e571085728e9a85296421b3ab60307d7' 
  AND (
    token = 'xxnl0dkGvtv3hdPx4dauk4hWE9OJF7+U1ESPHEqn9lw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032