UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LIIO+msjGiukV5Ui/GdPxIci/bYC3NtipV5nQiyWMt8=' 
WHERE 
  key_id = '345141e77478b7e03ba1bbe6fa8f25b8afb49614c3fed1e30475955c849ed696' 
  AND (
    token = 'LIIO+msjGiukV5Ui/GdPxIci/bYC3NtipV5nQiyWMt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054