UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L1r/W97FP05R+4Uy0UzENoJBjs2khUA8j6e1KgG/Gzo=' 
WHERE 
  key_id = '6da9bd7d5d47af1ea23c7e78c14d31f01d9069dc7d9e2a857d3c0c45eb571330' 
  AND (
    token = 'L1r/W97FP05R+4Uy0UzENoJBjs2khUA8j6e1KgG/Gzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024