UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmpNQBwo9m0O53rPQ/vw7ierPWpbOINDBzZY6b/TBBU=' 
WHERE 
  key_id = '5c783b0ca23df5e0f70791063976c67344ac54bd56fe6d1fff104b66072004e7' 
  AND (
    token = 'tmpNQBwo9m0O53rPQ/vw7ierPWpbOINDBzZY6b/TBBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031