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

Query time 0.00046