UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V5tcptti4vMV72sZ6vx7LTDqNnDr/1qWoWE8XcS40Zg=' 
WHERE 
  key_id = '3db99f2b2b365cbe45ea9d6617c63f7a16bf2c00da69a33fa8a2723c9fa23b94' 
  AND (
    token = 'V5tcptti4vMV72sZ6vx7LTDqNnDr/1qWoWE8XcS40Zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034