UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EEnzW116V3ILqqQHvQywuGA2JUcZt2Reu2Xpt2So5Hs=' 
WHERE 
  key_id = '9ce05d6c9516554fc1a24e3df9655eea6c97db0e8fcf2512aa870b3a73cf6542' 
  AND (
    token = 'EEnzW116V3ILqqQHvQywuGA2JUcZt2Reu2Xpt2So5Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032