UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'APDNC1LE3a38Ak+kNpiScfLTUzZAWIwRfHhoS7mZ4J0=' 
WHERE 
  key_id = '8b25c3b198b1e1e2d8421052218bf353ecb06025342dae3013ed961225384c66' 
  AND (
    token = 'APDNC1LE3a38Ak+kNpiScfLTUzZAWIwRfHhoS7mZ4J0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032