UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQKP/scbFj1oX9v5g9Jc+2ELggtu1ZozAwNfk2rhhKE=' 
WHERE 
  key_id = '644f8e6293ad00f5a2c0659a304e1e0bc8c821a9fd2bff378f28951341c44816' 
  AND (
    token = 'mQKP/scbFj1oX9v5g9Jc+2ELggtu1ZozAwNfk2rhhKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029