UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nO6JqkK9wL3uSk4Qpn5fKJB5TyBQ6Bao1680QAbUDZw=' 
WHERE 
  key_id = '20dd56d960f808b14dc2a369d5bc4557fccfa612794469be5e4503b67eb4db8f' 
  AND (
    token = 'nO6JqkK9wL3uSk4Qpn5fKJB5TyBQ6Bao1680QAbUDZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036