UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tQEihKtLr62PWJi3cXRAM5jaHrD8R9ToWDtBtzWN9fo=' 
WHERE 
  key_id = '05f5b977fc59ec103bf8ca4e1586011cfb7dbad81fed4020d7b17e00f7a6b00d' 
  AND (
    token = 'tQEihKtLr62PWJi3cXRAM5jaHrD8R9ToWDtBtzWN9fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022