UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sPhdrseL/zmOt0wkBCJiYC+RfsJQOejW0Kqo5iWOpFU=' 
WHERE 
  key_id = '9c8dccceb56b51a282b9b10f78ad95d0d675e6cc7e934bd898032b1df69c7ea8' 
  AND (
    token = 'sPhdrseL/zmOt0wkBCJiYC+RfsJQOejW0Kqo5iWOpFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020