UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XbWuNBFDLyf7VjyCuU/Tp6tELEEuOEBaNEEdelyDM5o=' 
WHERE 
  key_id = 'e077f5dad4a7e24f5d406459951e88273b95a069330eae734fe5bbc0078a8d79' 
  AND (
    token = 'XbWuNBFDLyf7VjyCuU/Tp6tELEEuOEBaNEEdelyDM5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027