UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+GeRYBfrmozAdCWWN68xhDPlYpCi+iB2acQL7+b8QoA=' 
WHERE 
  key_id = '6cfde255f798c404a285e62745edd71581400336190f3736fbba8d8a456c0299' 
  AND (
    token = '+GeRYBfrmozAdCWWN68xhDPlYpCi+iB2acQL7+b8QoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043