UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KozpnsgTqzDOV7uQjCwRsggMB27cpStUldb//VWfqH8=' 
WHERE 
  key_id = '0f6313c3829403dd5d0950a70a6130c8aa34ab388e35c7a2e7aa235950899355' 
  AND (
    token = 'KozpnsgTqzDOV7uQjCwRsggMB27cpStUldb//VWfqH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051