UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mNznItxz/dsWcdNOLX+CCpbyFqgWHvW6NjS2hRi42fE=' 
WHERE 
  key_id = '3266ca3e39609e178e158dc61f8b275df585bc94f3c4026545628d359a70feff' 
  AND (
    token = 'mNznItxz/dsWcdNOLX+CCpbyFqgWHvW6NjS2hRi42fE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046