UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQXZtPnRhwfltteBjBapxLuHbbx+rR6x7wK95/f3B3E=' 
WHERE 
  key_id = 'bd8f35796da0a18f069e28a320bf5b7f4640ceff78b4e62d3b32770ab7d365d5' 
  AND (
    token = 'KQXZtPnRhwfltteBjBapxLuHbbx+rR6x7wK95/f3B3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032