UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xrPaMDGOJ9exakXeFBBMuy1eByoatjVk3+s4/Ekan64=' 
WHERE 
  key_id = '7be5a98e97c58eb5bf65444282f9f26fc9c4586cf5ab1b9dd3619de690f44ead' 
  AND (
    token = 'xrPaMDGOJ9exakXeFBBMuy1eByoatjVk3+s4/Ekan64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038