UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+brN+0XO4ALVPDrid5sdYpC+kgUqMcryhG59KoD7hc4=' 
WHERE 
  key_id = '5c4bd54297d51e485ea85c2489c92a352a14e6cb355bf1bae587f4c6e23e40fe' 
  AND (
    token = '+brN+0XO4ALVPDrid5sdYpC+kgUqMcryhG59KoD7hc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036