UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JhYsmikDN5y1ErJPIZWvDC+qtTer6+CwDdc+9uL2Q6c=' 
WHERE 
  key_id = '20b7d6eb9d68cb49876716d32ece44c22cb8d11a2f8bc2200056afdeae6c330b' 
  AND (
    token = 'JhYsmikDN5y1ErJPIZWvDC+qtTer6+CwDdc+9uL2Q6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064