UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8K7iqavdQvioPgm6uiFomuidGSQYAnFUEMu6qdMsDgk=' 
WHERE 
  key_id = '56f7bf14f65b4d1cd2160514c7fbe598c0787e8679e88e312ef3bdfd8bad74b8' 
  AND (
    token = '8K7iqavdQvioPgm6uiFomuidGSQYAnFUEMu6qdMsDgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029