UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'veRfkVYrkEy8womWI2EBpzbVNZ1HmdUdZ8jeiC7Hevw=' 
WHERE 
  key_id = 'dbfc373ce0aff6fc0d84cfb5590a029d450f9d10b23c0837fddaf2fabae38606' 
  AND (
    token = 'veRfkVYrkEy8womWI2EBpzbVNZ1HmdUdZ8jeiC7Hevw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037