UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tMGj8YaYIhY8mz8cpFPE+qakr/lhmMmHT8gl5UBGQmk=' 
WHERE 
  key_id = 'a6d8b59426699319456c13bbf69897632982550eae8d7b2815ffc42d381566ee' 
  AND (
    token = 'tMGj8YaYIhY8mz8cpFPE+qakr/lhmMmHT8gl5UBGQmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032