UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nR0LZNH15Yuh9N9o472GpnIg9haiEbBMioQw19aZc+A=' 
WHERE 
  key_id = '4a4f40adfafed15177cb688bc1adbb4c87b00158c8080936aa933cc74882d90d' 
  AND (
    token = 'nR0LZNH15Yuh9N9o472GpnIg9haiEbBMioQw19aZc+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034